package io.jpress.commons.flowable;

import java.util.HashMap;
import java.util.Map;

public class FlowConsts {


    public static final String ACTION_STATUS_AGREE = "agree"; //同意，走下一步
    public static final String ACTION_STATUS_REFUSE = "refuse"; //拒绝，走下一步
    public static final String ACTION_STATUS_REBUT = "rebut"; //驳回
    public static final String ACTION_STATUS_STOP = "stop"; //终止流程
    public static final String ACTION_STATUS_UNKNOW = "unknow"; //状态未知，可能是还没有开始执行

    protected static final Map<String, String> actionStatusStrings = new HashMap<>();
    static {
        actionStatusStrings.put(ACTION_STATUS_AGREE, "同意");
        actionStatusStrings.put(ACTION_STATUS_REFUSE, "拒绝");
        actionStatusStrings.put(ACTION_STATUS_REBUT, "驳回");
        actionStatusStrings.put(ACTION_STATUS_STOP, "停止");
    }

    public static String getStatusString(String action){
        return actionStatusStrings.get(action);
    }


    //以下的这些参数，主要是给条件表达式用的
    public static final String VAR_COMMENT = "comment"; //上一个节点的评论意见
    public static final String VAR_ACTION = "action"; //这个参数是上个节点用户执行的动作


    //只有在多实例（会签）的场景下才会有值
    public static final String VAR_ACTION_COUNT = "actionCount"; //执行次数
    public static final String VAR_ACTION_AGREE_COUNT = "agreeCount"; //这个参数是上个节点用户执行 agree 的动作数量
    public static final String VAR_ACTION_REFUSE_COUNT = "refuseCount"; //这个参数是上个节点用户执行 refuse 的动作数量
    public static final String VAR_ACTION_REBUT_COUNT = "rebutCount"; //这个参数是上个节点用户执行 rebut 的动作数量
    public static final String VAR_ACTION_STOP_COUNT = "stopCount"; //这个参数是上个节点用户执行 stop 的动作数量


    public static final String VAR_CONTENT_TYPE = "contentType"; //涉及的内容类型
    public static final String VAR_CONTENT_ID = "contentId"; //涉及的内容ID
    public static final String VAR_CONTENT_TITLE = "contentTitle"; //涉及的内容标题


}
